<!DOCTYPE html>
<html>
<head>
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?d890b1f16fb364253e79c5bb20225c3a";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>


    

    

    
<!-- Baidu Tongji -->
<script>var _hmt = _hmt || []</script>
<script async src="//hm.baidu.com/hm.js?busuanzi_value_site_uv"></script>
<!-- End Baidu Tongji -->




    <meta charset="utf-8">
    <meta name="baidu-site-verification" content="FYMCShbUK8" />
    <meta name="baidu-site-verification" content="ZYRF7OxQRW" />
    <meta name="baidu-site-verification" content="cHSqtjI0PN" />
    <meta name="baidu-site-verification" content="cHSqtjI0PN" />
    <meta name="baidu-site-verification" content="cHSqtjI0PN" />
    
    
    <link rel="canonical" href="https://hhardyy.com/2019/11/30/eslint规范代码/">
    
    
    <title>eslint规范代码 | 小方块 - hhardyy.com | 复杂的坑+归其原理+了解实现规则===解决？解决成功：加油解决成功;</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#958e93">
    
    
    <meta name="keywords" content="eslint,代码规范">
    <meta name="description" content="是该给选手们订一套代码规范套餐了。。。">
<meta name="keywords" content="eslint,代码规范">
<meta property="og:type" content="article">
<meta property="og:title" content="eslint规范代码">
<meta property="og:url" content="http://yoursite.com/2019/11/30/eslint规范代码/index.html">
<meta property="og:site_name" content="小方块 - hhardyy.com">
<meta property="og:description" content="是该给选手们订一套代码规范套餐了。。。">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2020-01-13T15:17:38.295Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="eslint规范代码">
<meta name="twitter:description" content="是该给选手们订一套代码规范套餐了。。。">
    
        <link rel="alternate" type="application/atom+xml" title="小方块 - hhardyy.com" href="/atom.xml">
    
    <link rel="shortcut icon" href="/hardyfavicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/paulGraham.jpg)">
      <div class="brand" style="background-color:#4154b2">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">BingZhenhuang</h5>
          <a href="mailto:huangbingzhen@hhardyy.com" title="huangbingzhen@hhardyy.com" class="mail">huangbingzhen@hhardyy.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                所有文章
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/HHardyy" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://gitee.com/hhardyy" target="_blank" >
                <i class="icon icon-lg icon-cloud"></i>
                Gitee
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://juejin.im/user/59a26f926fb9a02487553b04"  >
                <i class="icon icon-lg icon-pencil"></i>
                掘金-圳
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://segmentfault.com/u/hhardyy"  >
                <i class="icon icon-lg icon-comments"></i>
                Segmentfault
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://codepen.io/HHardyy/" target="_blank" >
                <i class="icon icon-lg icon-codepen"></i>
                Codepen
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://www.freecodecamp.cn/hhardyy" target="_blank" >
                <i class="icon icon-lg icon-leaf"></i>
                Freecodecamp
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/友情链接"  >
                <i class="icon icon-lg icon-link"></i>
                友链
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">eslint规范代码</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">eslint规范代码</h1>
        <h5 class="subtitle">
            
                <time datetime="2019-11-30T03:30:47.000Z" itemprop="datePublished" class="page-time">
  2019-11-30
</time>


            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#局部安装-应用到当前项目"><span class="post-toc-number">1.</span> <span class="post-toc-text">局部安装(应用到当前项目)</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#全局安装（应用到所有项目）"><span class="post-toc-number">2.</span> <span class="post-toc-text">全局安装（应用到所有项目）</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#配置"><span class="post-toc-number">3.</span> <span class="post-toc-text">配置</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#使用"><span class="post-toc-number">4.</span> <span class="post-toc-text">使用</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#IDE-配置"><span class="post-toc-number">5.</span> <span class="post-toc-text">IDE 配置</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#错误级别"><span class="post-toc-number">6.</span> <span class="post-toc-text">错误级别</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#常用规则"><span class="post-toc-number">7.</span> <span class="post-toc-text">常用规则</span></a></li></ol>
        </nav>
    </aside>
    
<article id="post-eslint规范代码"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">eslint规范代码</h1>
        <div class="post-meta">
            <time class="post-time" title="2019-11-30 11:30:47" datetime="2019-11-30T03:30:47.000Z"  itemprop="datePublished">2019-11-30</time>

            


            

        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <p>是该给选手们订一套代码规范套餐了。。。</p>
<p><iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="86" src="//music.163.com/outchain/player?type=2&id=1371939273&auto=0&height=66"></iframe><br><a id="more"></a></p>
<p>在团队开发中，每个人的想法不一样，代码规范就不一样，每个人自由发挥的后果就是这个项目越来越走向重构，后面接手的人甚至无从下手。我自己也比较喜欢业务与plugins分开，plugins里面必须0业务。。。。。。跑偏了。。</p>
<h3 id="局部安装-应用到当前项目"><a href="#局部安装-应用到当前项目" class="headerlink" title="局部安装(应用到当前项目)"></a>局部安装(应用到当前项目)</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ npm install eslint --save-dev</div></pre></td></tr></table></figure>
<h3 id="全局安装（应用到所有项目）"><a href="#全局安装（应用到所有项目）" class="headerlink" title="全局安装（应用到所有项目）"></a>全局安装（应用到所有项目）</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g eslint</div></pre></td></tr></table></figure>
<h3 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h3><p>使用 .eslintrc文件<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">eslint --init</div></pre></td></tr></table></figure></p>
<h3 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h3><p>举例使用ele团队的规范<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install --save-dev eslint-config-elemefe eslint</div></pre></td></tr></table></figure></p>
<p>然后在.eslintrc中加上<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">	<span class="string">"extends"</span>: <span class="string">"elemefe"</span></div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><a href="https://www.npmjs.com/package/eslint-config-elemefe" target="_blank" rel="external">饿了么团队的eslint规范</a></p>
<h3 id="IDE-配置"><a href="#IDE-配置" class="headerlink" title="IDE 配置"></a>IDE 配置</h3><p>使用facebook的都在用的默认编辑器vscode，然后安装ESLint插件（在商店搜索安装即可），也可以装上根据eslint自动格式化的插件vetur，prettier等，然后在settings.json用户配置中自由设置（下面是我自己的）<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">  <span class="string">"vetur.format.defaultFormatter.js"</span>: <span class="string">"prettier-eslint"</span>,</div><div class="line">  <span class="string">"vetur.format.defaultFormatter.html"</span>: <span class="string">"js-beautify-html"</span>,</div><div class="line">  <span class="string">"vetur.format.defaultFormatterOptions"</span>: &#123;</div><div class="line">    <span class="string">"wrap_attributes"</span>: <span class="string">"force-aligned"</span></div><div class="line">  &#125;,</div><div class="line">  <span class="string">"editor.detectIndentation"</span>: <span class="literal">true</span>,   <span class="comment">// vscode默认启用了根据文件类型自动设置tabsize的选项</span></div><div class="line">  <span class="string">"editor.tabSize"</span>: <span class="number">2</span>,  <span class="comment">// 重新设定tabsize</span></div><div class="line">  <span class="comment">// "editor.formatOnSave": true,  // 保存时自动格式化 --vscode编辑器自带自动格式化会与设置的eslint规范有所冲突导致eslint报错</span></div><div class="line">  <span class="string">"eslint.autoFixOnSave"</span>: <span class="literal">true</span>, <span class="comment">//保存时使用eslint规范自动格式化</span></div><div class="line">  <span class="string">"workbench.iconTheme"</span>: <span class="string">"vscode-great-icons"</span>,</div><div class="line">  <span class="string">"eslint.enable"</span>: <span class="literal">true</span>,     <span class="comment">//true打开eslint语法检查，false关闭</span></div><div class="line">  <span class="string">"eslint.validate"</span>: [       <span class="comment">//eslint支持项自定义</span></div><div class="line">    <span class="string">"javascript"</span>,</div><div class="line">    <span class="string">"javascriptreact"</span>,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"language"</span>: <span class="string">"html"</span>,</div><div class="line">      <span class="string">"autoFix"</span>: <span class="literal">true</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"language"</span>: <span class="string">"vue"</span>,</div><div class="line">      <span class="string">"autoFix"</span>: <span class="literal">true</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"language"</span>: <span class="string">"react"</span>,</div><div class="line">      <span class="string">"autoFix"</span>: <span class="literal">true</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"language"</span>: <span class="string">"webpack"</span>,</div><div class="line">      <span class="string">"autoFix"</span>: <span class="literal">true</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">       <span class="string">"language"</span>: <span class="string">"typescript"</span>,</div><div class="line">       <span class="string">"autoFix"</span>: <span class="literal">true</span></div><div class="line">    &#125;</div><div class="line">    ....</div><div class="line">  ]</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>配好之后就能感受到写代码实时红线提示，当然再狠一点可以做一下git提交的验证，eslint检查不通过不允许提交,eslint的玩法有超多种，比较急一会要去接手一下一个离职选手的锅，先简单记录一下~，</p>
<h3 id="错误级别"><a href="#错误级别" class="headerlink" title="错误级别"></a>错误级别</h3><p>“off” or 0 - 关闭(禁用)规则<br>“warn” or 1 - 将规则视为一个警告（并不会导致检查不通过）<br>“error” or 2 - 将规则视为一个错误 (退出码为1，检查不通过) </p>
<h3 id="常用规则"><a href="#常用规则" class="headerlink" title="常用规则"></a>常用规则</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div><div class="line">135</div><div class="line">136</div><div class="line">137</div><div class="line">138</div><div class="line">139</div><div class="line">140</div><div class="line">141</div><div class="line">142</div><div class="line">143</div><div class="line">144</div><div class="line">145</div><div class="line">146</div><div class="line">147</div><div class="line">148</div><div class="line">149</div></pre></td><td class="code"><pre><div class="line">Possible Errors 可能的错误或逻辑错误 </div><div class="line">no-cond-assign 禁止条件表达式中出现模棱两可的赋值操作符 </div><div class="line">no-<span class="built_in">console</span> 禁用<span class="built_in">console</span> </div><div class="line">no-constant-condition 禁止在条件中使用常量表达式 </div><div class="line">no-<span class="keyword">debugger</span> 禁用 <span class="keyword">debugger</span> </div><div class="line">no-dupe-args 禁止 <span class="function"><span class="keyword">function</span> 定义中出现重名参数 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">dupe</span>-<span class="title">keys</span> 禁止对象字面量中出现重复的 <span class="title">key</span> </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">duplicate</span>-<span class="title">case</span> 禁止出现重复的 <span class="title">case</span> 标签 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">empty</span> 禁止出现空语句块 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">ex</span>-<span class="title">assign</span> 禁止对 <span class="title">catch</span> 子句的参数重新赋值 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">extra</span>-<span class="title">boolean</span>-<span class="title">cast</span> 禁止不必要的布尔转换 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">extra</span>-<span class="title">parens</span> 禁止不必要的括号 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">extra</span>-<span class="title">semi</span> 禁止不必要的分号 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">func</span>-<span class="title">assign</span> 禁止对 <span class="title">function</span> 声明重新赋值 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">inner</span>-<span class="title">declarations</span> 禁止在嵌套的块中出现变量声明或 <span class="title">function</span> 声明 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">irregular</span>-<span class="title">whitespace</span> 禁止在字符串和注释之外不规则的空白 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">obj</span>-<span class="title">calls</span> 禁止把全局对象作为函数调用 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">sparse</span>-<span class="title">arrays</span> 禁用稀疏数组 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">prototype</span>-<span class="title">builtins</span> 禁止直接使用<span class="title">Object</span>.<span class="title">prototypes</span> 的内置属性 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">unexpected</span>-<span class="title">multiline</span> 禁止出现令人困惑的多行表达式 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">unreachable</span> 禁止在<span class="title">return</span>、<span class="title">throw</span>、<span class="title">continue</span> 和 <span class="title">break</span>语句之后出现不可达代码 </span></div><div class="line"><span class="function"><span class="title">use</span>-<span class="title">isnan</span> 要求使用 <span class="title">isNaN</span>(<span class="params"></span>) 检查 <span class="title">NaN</span> </span></div><div class="line"><span class="function"><span class="title">valid</span>-<span class="title">typeof</span> 强制 <span class="title">typeof</span> 表达式与有效的字符串进行比较 </span></div><div class="line"><span class="function">—– —– </span></div><div class="line"><span class="function"><span class="title">Best</span> <span class="title">Practices</span> 最佳实践 </span></div><div class="line"><span class="function"><span class="title">array</span>-<span class="title">callback</span>-<span class="title">return</span> 强制数组方法的回调函数中有 <span class="title">return</span> 语句 </span></div><div class="line"><span class="function"><span class="title">block</span>-<span class="title">scoped</span>-<span class="title">var</span> 强制把变量的使用限制在其定义的作用域范围内 </span></div><div class="line"><span class="function"><span class="title">complexity</span> 指定程序中允许的最大环路复杂度 </span></div><div class="line"><span class="function"><span class="title">consistent</span>-<span class="title">return</span> 要求 <span class="title">return</span> 语句要么总是指定返回的值，要么不指定 </span></div><div class="line"><span class="function"><span class="title">curly</span> 强制所有控制语句使用一致的括号风格 </span></div><div class="line"><span class="function"><span class="title">default</span>-<span class="title">case</span> 要求 <span class="title">switch</span> 语句中有 <span class="title">default</span> 分支 </span></div><div class="line"><span class="function"><span class="title">dot</span>-<span class="title">location</span> 强制在点号之前和之后一致的换行 </span></div><div class="line"><span class="function"><span class="title">dot</span>-<span class="title">notation</span> 强制在任何允许的时候使用点号 </span></div><div class="line"><span class="function"><span class="title">eqeqeq</span> 要求使用 === 和 !== </span></div><div class="line"><span class="function"><span class="title">guard</span>-<span class="title">for</span>-<span class="title">in</span> 要求 <span class="title">for</span>-<span class="title">in</span> 循环中有一个 <span class="title">if</span> 语句 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">alert</span> 禁用 <span class="title">alert</span>、<span class="title">confirm</span> 和 <span class="title">prompt</span> </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">case</span>-<span class="title">declarations</span> 不允许在 <span class="title">case</span> 子句中使用词法声明 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">else</span>-<span class="title">return</span> 禁止 <span class="title">if</span> 语句中有 <span class="title">return</span> 之后有 <span class="title">else</span> </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">empty</span>-<span class="title">function</span> 禁止出现空函数 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">eq</span>-<span class="title">null</span> 禁止在没有类型检查操作符的情况下与 <span class="title">null</span> 进行比较 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">eval</span> 禁用 <span class="title">eval</span>(<span class="params"></span>) </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">extra</span>-<span class="title">bind</span> 禁止不必要的 .<span class="title">bind</span>(<span class="params"></span>) 调用 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">fallthrough</span> 禁止 <span class="title">case</span> 语句落空 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">floating</span>-<span class="title">decimal</span> 禁止数字字面量中使用前导和末尾小数点 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">implicit</span>-<span class="title">coercion</span> 禁止使用短符号进行类型转换 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">implicit</span>-<span class="title">globals</span> 禁止在全局范围内使用 <span class="title">var</span> 和命名的 <span class="title">function</span> 声明 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">invalid</span>-<span class="title">this</span>: 禁止 <span class="title">this</span> 关键字出现在类和类对象之外 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">lone</span>-<span class="title">blocks</span> 禁用不必要的嵌套块 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">loop</span>-<span class="title">func</span> 禁止在循环中出现 <span class="title">function</span> 声明和表达式 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">magic</span>-<span class="title">numbers</span> 禁用魔术数字 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">multi</span>-<span class="title">spaces</span> 禁止使用多个空格 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">multi</span>-<span class="title">str</span> 禁止使用多行字符串 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">new</span> 禁止在非赋值或条件语句中使用 <span class="title">new</span> 操作符 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">new</span>-<span class="title">func</span> 禁止对 <span class="title">Function</span> 对象使用 <span class="title">new</span> 操作符 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">new</span>-<span class="title">wrappers</span> 禁止对 <span class="title">String</span>，<span class="title">Number</span> 和 <span class="title">Boolean</span> 使用 <span class="title">new</span> 操作符 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">param</span>-<span class="title">reassign</span> 不允许对 <span class="title">function</span> 的参数进行重新赋值 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">redeclare</span> 禁止使用 <span class="title">var</span> 多次声明同一变量 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">return</span>-<span class="title">assign</span> 禁止在 <span class="title">return</span> 语句中使用赋值语句 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">script</span>-<span class="title">url</span> 禁止使用 <span class="title">javascript</span>: <span class="title">url</span> </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">self</span>-<span class="title">assign</span> 禁止自我赋值 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">self</span>-<span class="title">compare</span> 禁止自身比较 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">sequences</span> 禁用逗号操作符 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">unmodified</span>-<span class="title">loop</span>-<span class="title">condition</span> 禁用一成不变的循环条件 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">unused</span>-<span class="title">expressions</span> 禁止出现未使用过的表达式 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">useless</span>-<span class="title">call</span> 禁止不必要的 .<span class="title">call</span>(<span class="params"></span>) 和 .<span class="title">apply</span>(<span class="params"></span>) </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">useless</span>-<span class="title">concat</span> 禁止不必要的字符串字面量或模板字面量的连接 </span></div><div class="line"><span class="function"><span class="title">vars</span>-<span class="title">on</span>-<span class="title">top</span> 要求所有的 <span class="title">var</span> 声明出现在它们所在的作用域顶部 </span></div><div class="line"><span class="function">—– —– </span></div><div class="line"><span class="function"><span class="title">Strict</span> <span class="title">Mode</span> 使用严格模式和严格模式指 </span></div><div class="line"><span class="function"><span class="title">strict</span> 要求或禁止使用严格模式指令 </span></div><div class="line"><span class="function">—– —– </span></div><div class="line"><span class="function"><span class="title">Variables</span> 变量声明 </span></div><div class="line"><span class="function"><span class="title">init</span>-<span class="title">declarations</span> 要求或禁止 <span class="title">var</span> 声明中的初始化 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">catch</span>-<span class="title">shadow</span> 不允许 <span class="title">catch</span> 子句的参数与外层作用域中的变量同名 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">restricted</span>-<span class="title">globals</span> 禁用特定的全局变量 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">shadow</span> 禁止 <span class="title">var</span> 声明 与外层作用域的变量同名 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">undef</span> 禁用未声明的变量，除非它们在 /<span class="title">global</span> / 注释中被提到 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">undef</span>-<span class="title">init</span> 禁止将变量初始化为 <span class="title">undefined</span> </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">unused</span>-<span class="title">vars</span> 禁止出现未使用过的变量 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">use</span>-<span class="title">before</span>-<span class="title">define</span> 不允许在变量定义之前使用它们 </span></div><div class="line"><span class="function">—– —– </span></div><div class="line"><span class="function"><span class="title">Nodejs</span> <span class="title">and</span> <span class="title">CommonJS</span> <span class="title">Node</span>.<span class="title">js</span>,<span class="title">CommonJS</span> </span></div><div class="line"><span class="function"><span class="title">global</span>-<span class="title">require</span> 要求 <span class="title">require</span>(<span class="params"></span>) 出现在顶层模块作用域中 </span></div><div class="line"><span class="function"><span class="title">handle</span>-<span class="title">callback</span>-<span class="title">err</span> 要求回调函数中有容错处理 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">mixed</span>-<span class="title">requires</span> 禁止混合常规 <span class="title">var</span> 声明和 <span class="title">require</span> 调用 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">new</span>-<span class="title">require</span> 禁止调用 <span class="title">require</span> 时使用 <span class="title">new</span> 操作符 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">path</span>-<span class="title">concat</span> 禁止对 <span class="title">dirname</span> 和 <span class="title">filename</span>进行字符串连接 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">restricted</span>-<span class="title">modules</span> 禁用指定的通过 <span class="title">require</span> 加载的模块 </span></div><div class="line"><span class="function">—– —– </span></div><div class="line"><span class="function"><span class="title">Stylistic</span> <span class="title">Issues</span> 风格指南 </span></div><div class="line"><span class="function"><span class="title">array</span>-<span class="title">bracket</span>-<span class="title">spacing</span> 强制数组方括号中使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">block</span>-<span class="title">spacing</span> 强制在单行代码块中使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">brace</span>-<span class="title">style</span> 强制在代码块中使用一致的大括号风格 </span></div><div class="line"><span class="function"><span class="title">camelcase</span> 强制使用骆驼拼写法命名约定 </span></div><div class="line"><span class="function"><span class="title">comma</span>-<span class="title">spacing</span> 强制在逗号前后使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">comma</span>-<span class="title">style</span> 强制使用一致的逗号风格 </span></div><div class="line"><span class="function"><span class="title">computed</span>-<span class="title">property</span>-<span class="title">spacing</span> 强制在计算的属性的方括号中使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">eol</span>-<span class="title">last</span> 强制文件末尾至少保留一行空行 </span></div><div class="line"><span class="function"><span class="title">func</span>-<span class="title">names</span> 强制使用命名的 <span class="title">function</span> 表达式 </span></div><div class="line"><span class="function"><span class="title">func</span>-<span class="title">style</span> 强制一致地使用函数声明或函数表达式 </span></div><div class="line"><span class="function"><span class="title">indent</span> 强制使用一致的缩进 </span></div><div class="line"><span class="function"><span class="title">jsx</span>-<span class="title">quotes</span> 强制在 <span class="title">JSX</span> 属性中一致地使用双引号或单引号 </span></div><div class="line"><span class="function"><span class="title">key</span>-<span class="title">spacing</span> 强制在对象字面量的属性中键和值之间使用一致的间距 </span></div><div class="line"><span class="function"><span class="title">keyword</span>-<span class="title">spacing</span> 强制在关键字前后使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">linebreak</span>-<span class="title">style</span> 强制使用一致的换行风格 </span></div><div class="line"><span class="function"><span class="title">lines</span>-<span class="title">around</span>-<span class="title">comment</span> 要求在注释周围有空行 </span></div><div class="line"><span class="function"><span class="title">max</span>-<span class="title">depth</span> 强制可嵌套的块的最大深度 </span></div><div class="line"><span class="function"><span class="title">max</span>-<span class="title">len</span> 强制一行的最大长度 </span></div><div class="line"><span class="function"><span class="title">max</span>-<span class="title">lines</span> 强制最大行数 </span></div><div class="line"><span class="function"><span class="title">max</span>-<span class="title">nested</span>-<span class="title">callbacks</span> 强制回调函数最大嵌套深度 </span></div><div class="line"><span class="function"><span class="title">max</span>-<span class="title">params</span> 强制 <span class="title">function</span> 定义中最多允许的参数数量 </span></div><div class="line"><span class="function"><span class="title">max</span>-<span class="title">statements</span> 强制 <span class="title">function</span> 块最多允许的的语句数量 </span></div><div class="line"><span class="function"><span class="title">max</span>-<span class="title">statements</span>-<span class="title">per</span>-<span class="title">line</span> 强制每一行中所允许的最大语句数量 </span></div><div class="line"><span class="function"><span class="title">new</span>-<span class="title">cap</span> 要求构造函数首字母大写 </span></div><div class="line"><span class="function"><span class="title">new</span>-<span class="title">parens</span> 要求调用无参构造函数时有圆括号 </span></div><div class="line"><span class="function"><span class="title">newline</span>-<span class="title">after</span>-<span class="title">var</span> 要求或禁止 <span class="title">var</span> 声明语句后有一行空行 </span></div><div class="line"><span class="function"><span class="title">newline</span>-<span class="title">before</span>-<span class="title">return</span> 要求 <span class="title">return</span> 语句之前有一空行 </span></div><div class="line"><span class="function"><span class="title">newline</span>-<span class="title">per</span>-<span class="title">chained</span>-<span class="title">call</span> 要求方法链中每个调用都有一个换行符 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">array</span>-<span class="title">constructor</span> 禁止使用 <span class="title">Array</span> 构造函数 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">continue</span> 禁用 <span class="title">continue</span> 语句 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">inline</span>-<span class="title">comments</span> 禁止在代码行后使用内联注释 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">lonely</span>-<span class="title">if</span> 禁止 <span class="title">if</span> 作为唯一的语句出现在 <span class="title">else</span> 语句中 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">mixed</span>-<span class="title">spaces</span>-<span class="title">and</span>-<span class="title">tabs</span> 不允许空格和 <span class="title">tab</span> 混合缩进 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">multiple</span>-<span class="title">empty</span>-<span class="title">lines</span> 不允许多个空行 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">negated</span>-<span class="title">condition</span> 不允许否定的表达式 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">plusplus</span> 禁止使用一元操作符 ++ 和 – </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">spaced</span>-<span class="title">func</span> 禁止 <span class="title">function</span> 标识符和括号之间出现空格 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">ternary</span> 不允许使用三元操作符 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">trailing</span>-<span class="title">spaces</span> 禁用行尾空格 </span></div><div class="line"><span class="function"><span class="title">no</span>-<span class="title">whitespace</span>-<span class="title">before</span>-<span class="title">property</span> 禁止属性前有空白 </span></div><div class="line"><span class="function"><span class="title">object</span>-<span class="title">curly</span>-<span class="title">newline</span> 强制花括号内换行符的一致性 </span></div><div class="line"><span class="function"><span class="title">object</span>-<span class="title">curly</span>-<span class="title">spacing</span> 强制在花括号中使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">object</span>-<span class="title">property</span>-<span class="title">newline</span> 强制将对象的属性放在不同的行上 </span></div><div class="line"><span class="function"><span class="title">one</span>-<span class="title">var</span> 强制函数中的变量要么一起声明要么分开声明 </span></div><div class="line"><span class="function"><span class="title">one</span>-<span class="title">var</span>-<span class="title">declaration</span>-<span class="title">per</span>-<span class="title">line</span> 要求或禁止在 <span class="title">var</span> 声明周围换行 </span></div><div class="line"><span class="function"><span class="title">operator</span>-<span class="title">assignment</span> 要求或禁止在可能的情况下要求使用简化的赋值操作符 </span></div><div class="line"><span class="function"><span class="title">operator</span>-<span class="title">linebreak</span> 强制操作符使用一致的换行符 </span></div><div class="line"><span class="function"><span class="title">quote</span>-<span class="title">props</span> 要求对象字面量属性名称用引号括起来 </span></div><div class="line"><span class="function"><span class="title">quotes</span> 强制使用一致的反勾号、双引号或单引号 </span></div><div class="line"><span class="function"><span class="title">require</span>-<span class="title">jsdoc</span> 要求使用 <span class="title">JSDoc</span> 注释 </span></div><div class="line"><span class="function"><span class="title">semi</span> 要求或禁止使用分号而不是 <span class="title">ASI</span> </span></div><div class="line"><span class="function"><span class="title">semi</span>-<span class="title">spacing</span> 强制分号之前和之后使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">sort</span>-<span class="title">vars</span> 要求同一个声明块中的变量按顺序排列 </span></div><div class="line"><span class="function"><span class="title">space</span>-<span class="title">before</span>-<span class="title">blocks</span> 强制在块之前使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">space</span>-<span class="title">before</span>-<span class="title">function</span>-<span class="title">paren</span> 强制在 <span class="title">function</span>的左括号之前使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">space</span>-<span class="title">in</span>-<span class="title">parens</span> 强制在圆括号内使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">space</span>-<span class="title">infix</span>-<span class="title">ops</span> 要求操作符周围有空格 </span></div><div class="line"><span class="function"><span class="title">space</span>-<span class="title">unary</span>-<span class="title">ops</span> 强制在一元操作符前后使用一致的空格 </span></div><div class="line"><span class="function"><span class="title">spaced</span>-<span class="title">comment</span> 强制在注释中 // 或 /* 使用一致的空格</span></div></pre></td></tr></table></figure>

        </div>

        <blockquote class="post-copyright">
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2020-01-13T15:17:38.295Z" itemprop="dateUpdated">2020-01-13 23:17:38</time>
</span><br>


        
        谢谢浏览，我会继续努力的，示例：<a href="/2019/11/30/eslint规范代码/" target="_blank" rel="external">http://yoursite.com/2019/11/30/eslint规范代码/</a>
        
    </div>
    <footer>
        <a href="http://yoursite.com">
            <img src="/img/avatar.jpg" alt="BingZhenhuang">
            BingZhenhuang
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/eslint/">eslint</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/代码规范/">代码规范</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/2019/11/30/eslint规范代码/&title=《eslint规范代码》 — 小方块 - hhardyy.com&pic=http://yoursite.com/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/2019/11/30/eslint规范代码/&title=《eslint规范代码》 — 小方块 - hhardyy.com&source=是该给选手们订一套代码规范套餐了。。。
" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/2019/11/30/eslint规范代码/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《eslint规范代码》 — 小方块 - hhardyy.com&url=http://yoursite.com/2019/11/30/eslint规范代码/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/2019/11/30/eslint规范代码/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2020/01/08/带你入门Stimulsoft报表/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">Stimulsoft in web</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2019/11/16/vue3基本玩法/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">vue3基本玩法</h4>
      </a>
    </div>
  
</nav>



    














</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        🤠 请我喝可乐！
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content" style="width:50%">
        
        <div class="reward-code" style="text-align:center">
            <div style="width:300px;margin:0px auto;">
               <img id="rewardCode" style="width:50%;height:60%;display:block; margin:0px auto;" src="/img/alipay.jpg" alt="支付宝打赏二维码">
               <span style="display:inline-block; margin-bottom:20px;">0.88(支付宝 aliPay)</span>
               <img id="rewardCode" style="width:50%;height:60%;display:block; margin:0px auto;" src="/img/wechat.jpg" alt="微信打赏二维码">
               <span style="display:inline-block;">0.88(微信 weChat)</span>
            </div>
        </div>
    </div>
</div>



</div>

        <script>
!function(e,t,a){function n(){c(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),o(),r()}function r(){for(var e=0;e<d.length;e++)d[e].alpha<=0?(t.body.removeChild(d[e].el),d.splice(e,1)):(d[e].y--,d[e].scale+=.004,d[e].alpha-=.013,d[e].el.style.cssText="left:"+d[e].x+"px;top:"+d[e].y+"px;opacity:"+d[e].alpha+";transform:scale("+d[e].scale+","+d[e].scale+") rotate(45deg);background:"+d[e].color+";z-index:99999");requestAnimationFrame(r)}function o(){var t="function"==typeof e.onclick&&e.onclick;e.onclick=function(e){t&&t(),i(e)}}function i(e){var a=t.createElement("div");a.className="heart",d.push({el:a,x:e.clientX-5,y:e.clientY-5,scale:1,alpha:1,color:s()}),t.body.appendChild(a)}function c(e){var a=t.createElement("style");a.type="text/css";try{a.appendChild(t.createTextNode(e))}catch(t){a.styleSheet.cssText=e}t.getElementsByTagName("head")[0].appendChild(a)}function s(){return"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}var d=[];e.requestAnimationFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)}}(),n()}(window,document);
</script>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script>
    function secondToDate(second) {
        if (!second) {
            return 0;
        }
        var time = new Array(0, 0, 0, 0, 0);
        if (second >= 365 * 24 * 3600) {
            time[0] = parseInt(second / (365 * 24 * 3600));
            second %= 365 * 24 * 3600;
        }
        if (second >= 24 * 3600) {
            time[1] = parseInt(second / (24 * 3600));
            second %= 24 * 3600;
        }
        if (second >= 3600) {
            time[2] = parseInt(second / 3600);
            second %= 3600;
        }
        if (second >= 60) {
            time[3] = parseInt(second / 60);
            second %= 60;
        }
        if (second > 0) {
            time[4] = second;
        }
        return time;
    }</script>
<script type="text/javascript" language="javascript">
    function setTime() {
        var create_time = Math.round(new Date(Date.UTC(2017, 08, 18, 11, 42, 23)).getTime() / 1000);
        var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
        currentTime = secondToDate((timestamp - create_time));
        currentTimeHtml = 'Running：' + currentTime[0] + '年 ' + currentTime[1] + '天 '
                + currentTime[2] + '时 ' + currentTime[3] + '分 ' + currentTime[4]
                + '秒';
        document.getElementById("htmer_time").innerHTML = currentTimeHtml;
    }    setInterval(setTime, 1000);
</script>
<footer class="footer">
    <div class="top">
        

        <p>
          <span id="busuanzi_container_page_pv">
             [&nbsp;浏览量：&nbsp;<span id="busuanzi_value_page_pv"></span>&nbsp;]
          </span>
        </p>
    </div>
    <div class="bottom">
        <p>
        <span>BingZhenhuang &copy; 2017 - 2020</span>
            <span>
                
                Power by <a href="https://hhardyy.github.io/" target="_blank">zhen On August 8</a> 
            </span>
            <span id="htmer_time" "></span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/2019/11/30/eslint规范代码/&title=《eslint规范代码》 — 小方块 - hhardyy.com&pic=http://yoursite.com/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/2019/11/30/eslint规范代码/&title=《eslint规范代码》 — 小方块 - hhardyy.com&source=是该给选手们订一套代码规范套餐了。。。
" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/2019/11/30/eslint规范代码/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《eslint规范代码》 — 小方块 - hhardyy.com&url=http://yoursite.com/2019/11/30/eslint规范代码/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/2019/11/30/eslint规范代码/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: true };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>








<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '(•‾̑⌣‾̑•)✧˖°回来看我';
            clearTimeout(titleTime);
        } else {
            document.title = '(゜-゜)つロ欢迎回来';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
